#ifndef  __EVENT_DATA_H__
#define  __EVENT_DATA_H__

#include "typedef.h"

#ifdef _cplusplus
extern "c"{
#endif

enum
{
	 UNSPECIFIED 		= 0		//unspecified byte 2
	 , TRIGGER_VALUE 	= 1		//Trigger reading in byte 2 
	 , OEM_CODE 		= 2		//OEM code in byte 2 
	 , EXTENSION_CODE 	= 3		//sensor-specific event extension code in byte 2
};

enum
{
	 STATE_DEAASSERTED 	= 0		//State Deasserted
	 , STATE_ASSERTED 	= 1		//State Asserted
};

//EventData1 Formate
typedef struct _EventData1
{
#ifdef BIG_EDIAN
	uint8 m_Data2Format:2;	//BIT[6-7]
	uint8 m_Data3Format:2;	//BIT[4-5]
	uint8 m_Offset:4;		//BIT[0-3]
#else
	uint8 m_Offset:4;		//BIT[0-3]
	uint8 m_Data2Format:2;	//BIT[4-5]
	uint8 m_Data3Format:2;	//BIT[6-7]
#endif
}EventData1;

//EventData2 Formate
typedef struct _EventData2
{
#ifdef BIG_EDIAN
	uint8 m_OptionalOffset2:4;	//BIT[4-7]
	uint8 m_OptionalOffset1:4;	//BIT[0-3]
#else
	uint8 m_OptionalOffset1:4;	//BIT[0-3]
	uint8 m_OptionalOffset2:4;	//BIT[4-7]
#endif
}EventData2;

/*
	union
	{
		struct
		{
		#ifdef BIG_EDIAN
			uint8 m_Data2Format:2;	//BIT[6-7]
			uint8 m_Data3Format:2;	//BIT[4-5]
			uint8 m_Offset:4;		//BIT[0-3]
		#else
			uint8 m_Offset:4;		//BIT[0-3]
			uint8 m_Data2Format:2;	//BIT[4-5]
			uint8 m_Data3Format:2;	//BIT[6-7]
		#endif
		};
		uint8 	m_EventData1;
	};
*/

typedef struct _EventData
{
	#ifdef BIG_EDIAN
    uint8   m_EventDir:1;	//MSB [7] event transition direction  0= assertion 1= Deassertion 
    uint8   m_EventType:7;	//LSB [6:0] Event Type
	#else
    uint8   m_EventType:7;  //LSB [6:0]
    uint8   m_EventDir:1;	//MSB [7]
	#endif
	EventData1 m_EventData1;
	uint8 	m_EventData2;
	uint8 	m_EventData3;
}EventData;

typedef struct _EventReqMsg
{
    uint8   m_EvMRev;     
    uint8   m_SensorType;  
    uint8   m_SensorId;    
	EventData	m_EventData;
}EventReqMsg;

void EventData_Dump(EventData* pEventData);

#ifdef _cplusplus
}
#endif

#endif 	/*_NMCPEMMC_SDRH_*/



